#ifndef ITG3200_h
#define ITG3200_h

#include "Arduino.h"

/*
ITG3200 implements an interface to the InvenSense ITG-3200 3-axis gyro

Simple interface initializes gyro & reads rates

Gyro offsets can be set or calibrated
*/

class ITG3200
{
  public:
    ITG3200(void);
    void begin(void);                     // Initializes gyro - default I2C addr = 0x69
    void begin(int I2C_addr);             // Init & sets I2C_addr (use for I2C = 0x68)
                                          // Default BW setting = 1kHz & handles "Gain = 0x03"
    void get_rates(void);                 // Reads gyro rates
    void set_offset(int num_samples);     // Performs gyro cal with num_samples
    void set_offset(int x_off, int y_off, int z_off);  // Adds values to current offsets
    int x_gyro;                           // x- (y-,z-) rates from last get_rates()
    int y_gyro;                           // Scale factor = 0.06956522 degrees/s/LSB
    int z_gyro;                           //              = 1.214142 mrad/s/LSB

      
  private:
    int _gADDR;
    byte _gGYRO;
    byte _gCSEL;
    byte _gXCLK;
    byte _gDLPF;
    byte _gSCBW;
    int _x_off;
    int _y_off;
    int _z_off;

};

#endif
